Skip to main content

factorial

factorial(dataIn: number[] | number[][] | Mat | Tensor | number) : number | any[] | Mat | Tensor

param dataIn The structure to find the factorial of (element-wise manner). Can be a number, Mat, Array or Tensor

returns: any[] | Mat | Tensor | number - In the case of a number it returns the standard dataIn!. In the case of a different structure, it returns a copy of the matrix with each element replaced by its factorial, i.e. element-wise factorial. Recall that a factorial of a number is number!=number*number-1*number-2*...*2*1